package main.Q1501_1600;

public class Q1531_1540 {
    public static void main(String[] args) {
        System.out.println("Question1531：");
        System.out.println("Question1532：");
        System.out.println("Question1533：");
        System.out.println("Question1534：");
        System.out.println("Question1535：");
        System.out.println("Question1536：");
        System.out.println("Question1537：");
        System.out.println("Question1538：");
        System.out.println("Question1539：");
        int[] arr={1,2};
        System.out.println(new Question1539().findKthPositive(arr,1));
        System.out.println("Question1540：");
    }
}

class Question1539{
    public int findKthPositive(int[] arr, int k) {
        int start=1,i=0;
        while (true){
            if (k==0){
                return start-1;
            }else {
                if (i<arr.length&&start != arr[i]){
                    start++;
                    k--;
                }else if (i<arr.length&&start==arr[i]){
                    i++;
                    start++;
                }else {
                    start++;
                    k--;
                }
            }
        }
    }
}